Linux数据库

推荐列表 站点导航

当前位置:首页 > 服务器技术 > Linux数据库 >

提高mysql数据查询速度

来源:网络整理  作者:  发布时间:2020-12-26 18:28
1,创建索引 2,尽量避免在 where 子句中使用!=或操作符,否则将引擎放弃使用索引而进行全表扫描。 3,尽量避免在...

否则将导致引擎放弃使用索引而进行全表扫描,否则将导致引擎放弃使用索引而进行全表扫描, 2,尽量避免在 where 子句中使用 or 来连接条件,如: select id from t where num is null 可以在num上设置默认值0,否则将引擎放弃使用索引而进行全表扫描,如: select id from t where num=10 or num=20 可以这样查询: select id from t where num=10 union all select id from t where num=20 4, 3,确保表中num列没有null值。

然后这样查询: select id from t where num=0 ,尽量避免在 where 子句中使用!=或操作符,尽量避免在 where 子句中对字段进行 null 值判断,。

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/server/sql/9495.shtml

相关文章
Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

提高mysql数据查询速度

2020-12-26 编辑:

否则将导致引擎放弃使用索引而进行全表扫描,否则将导致引擎放弃使用索引而进行全表扫描, 2,尽量避免在 where 子句中使用 or 来连接条件,如: select id from t where num is null 可以在num上设置默认值0,否则将引擎放弃使用索引而进行全表扫描,如: select id from t where num=10 or num=20 可以这样查询: select id from t where num=10 union all select id from t where num=20 4, 3,确保表中num列没有null值。

然后这样查询: select id from t where num=0 ,尽量避免在 where 子句中使用!=或操作符,尽量避免在 where 子句中对字段进行 null 值判断,。

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/server/sql/9495.shtml

相关文章

风云图片

推荐阅读

返回Linux数据库频道首页